# cmake最低版本
# Set the minimum required version of cmake for a project.
cmake_minimum_required(VERSION 3.0)

# 项目名称
# Set a name, version, and enable languages for the entire project.
project(jrtplibTest VERSION 0.1.1)


message("=======================================")
message("项目版本信息")
message("---------------------------------------")
message(${PROJECT_NAME})
message(${PROJECT_SOURCE_DIR})
message(${PROJECT_BINARY_DIR})
message(${PROJECT_VERSION})
message("---------------------------------------")

# 源代码文件和头文件加入变量SRC_LIST(可多组)
# Find all source files in a directory.
aux_source_directory(. SRC_LIST)

message(STATUS "=======================================")
message(STATUS "项目源文件列表")
message(STATUS "---------------------------------------")
foreach(src_filename ${SRC_LIST})
    message(STATUS ${src_filename})
endforeach(src_filename)
message(STATUS "---------------------------------------")

# 头文件路径(可多组)
# Add include directories to the build.
include_directories(../JRTPLIB/install/include)
include_directories(../JRTPLIB/install/include/jrtplib3)
include_directories(../JThread/install/include)
include_directories(../JThread/install/include/jthread)

# 库搜索路径(可多组)
# Specify directories in which the linker will look for libraries.
link_directories(../JRTPLIB/install/lib)
link_directories(../JThread/install/lib)

# 生成程序名
# Add an executable to the project using the specified source files.
ADD_EXECUTABLE(jrtplibTest ${SRC_LIST})

# 库名(可多组)
# Link a target to given libraries
target_link_libraries(jrtplibTest -ljrtp)
target_link_libraries(jrtplibTest -ljthread -lpthread)

set(CMAKE_INSTALL_BINDIR "bin")
message(STATUS "=======================================")
message(STATUS "CMAKE_INSTALL_BINDIR")
message(STATUS "---------------------------------------")
message(STATUS ${CMAKE_INSTALL_BINDIR})
message(STATUS "---------------------------------------")

install(
    TARGETS jrtplibTest
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 
)

# install(
#     CODE "MESSAGE(\"Sample install message.\")"
# )
# INSTALL(TARGETS jrtplibTest
#        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
# )